<?php
defined('IN_PHPCMS') or exit('No permission resources.');
class  contact{
	function __construct() {
		$this->caswee_db = pc_base::load_model('caswee_contact');
		$this->caswee4_db = pc_base::load_model('caswee_company');
		$this->caswee1_db = pc_base::load_model('caswee_logo');
		$this->caswee2_db = pc_base::load_model('caswee_logounder');
			$this->caswee5_db = pc_base::load_model('caswee_product');
			$this->caswee6_db = pc_base::load_model('caswee_new');
			$this->caswee7_db = pc_base::load_model('caswee_services');
			$this->caswee8_db = pc_base::load_model('caswee_support');
			$this->caswee9_db = pc_base::load_model('caswee_contacts');
			$this->caswee3_db = pc_base::load_model('caswee_logobuy');
		$this->_username = param::get_cookie('_username');
		$this->_userid = param::get_cookie('_userid');
		$this->casweecontact_db = pc_base::load_model('caswee_contacts');
  		
	}
	
	public function init() { 
	

		$_username = $this->_username;
	
	 $style=$_GET['style'];
	 $lang=$_GET['lang'];
  		if($lang==cn){
			 $where=isset($_GET['style'])?"class1='$style'":null;
			 
			 $where3="lang='cn'";
			 $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
			 $infos = $this->caswee_db->listinfo($where,$order = 'id DESC',$page, $pages = '12');
			 $infos2 = $this->caswee2_db->listinfo($where2,$order = 'id DESC',$page, $pages = '9');
			 $infos1 = $this->caswee1_db->listinfo($where2,$order = 'id DESC',$page, $pages = '9');
			 $infos3 = $this->caswee3_db->listinfo($where2,$order = 'id DESC',$page, $pages = '8');
			 $infos4 = $this->caswee4_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			$infos5 = $this->caswee5_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			$infos6 = $this->caswee6_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			$infos7 = $this->caswee7_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			$infos8 = $this->caswee8_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			$infos9 = $this->caswee9_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			
		$infos10 = $this->caswee9_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
			include template('caswee_CN', 'contactshow');}
			else{
				 $where3="lang='en'";
	  $where=isset($_GET['style'])?"class1='$style'":null;
	$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
		$infos = $this->caswee_db->listinfo($where,$order = 'id DESC',$page, $pages = '9');
		$infos2 = $this->caswee2_db->listinfo($where2,$order = 'id DESC',$page, $pages = '9');
		$infos12 = $this->casweecontact_db->listinfo($where2,$order = 'id DESC',$page, $pages = '9');
		$infos4 = $this->caswee4_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
		$infos1 = $this->caswee1_db->listinfo($where,$order = 'id DESC',$page, $pages = '9');
		$infos3 = $this->caswee3_db->listinfo($where,$order = 'id DESC',$page, $pages = '8');
	$infos5 = $this->caswee5_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
	$infos6 = $this->caswee6_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
	$infos7 = $this->caswee7_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
	$infos8 = $this->caswee8_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
	$infos9 = $this->caswee9_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
	$infos10 = $this->caswee9_db->listinfo($where3,$order = 'id DESC',$page, $pages = '8');
		$pages = $this->caswee_db->pages;
		$pages2 = $this->casweecontact_db->pages;
			$action=$_GET["action"];
			$template=contact.$action;
		
		include template('caswee',$template);
	}  
	}
 /**
	 *	在线留言 
	 */
		public function ly(){
 	$link_db = pc_base::load_model(caswee_contact);
	
			$_POST['ly']['title'] =$_POST['title'];
 			$_POST['ly']['tel'] =$_POST['tel'];
 			$_POST['ly']['fax'] = $_POST['fax'];
 			$_POST['ly']['title'] = $_POST['title'];
			$_POST['ly']['contactname'] = $_POST['contactname'];
			$_POST['ly']['ea']=$_POST['ea'];
			$_POST['ly']['address']=$_POST['address'];
			
 			
  			$link_db->update($_POST['ly'],$_POST['ly']['id']=1);
 			showmessage(L('add_success'), "?m=caswee&c=contact&action=connect");
 		
 
 			
 }
		public function la(){

 			
			
			$_POST['la']['class1']=$_POST['class1'];
		$_POST['la']['link']=$_POST['link'];
 			$_POST['la']['lang']=$_POST['class'];
  			$this->casweecontact_db->insert($_POST['la']);
 			showmessage(L('add_success'), "?m=caswee&c=contact&action=class");
 		
 
 			
 }
public function delete(){
		$id=$_GET['id'];
		  	$_username=$this->_username;
	if(!$_username){
			showmessage(L('请登录后再进行操作！'),'index.php?m=member&c=index&a=login');
		}
			$this->caswee_db->delete(array('id'=>$id));
			showmessage(L('删除成功！'),'index.php?m=caswee&c=contact&action=manage');


	}
	public function lb(){
 	
		
 		
 		$id=$_POST['id'];
 			$_POST['ly']['class1'] =$_POST['class1'];
			$_POST['ly']['link'] =$_POST['link'];
			
			
 			
  			$this->casweecontact_db->update($_POST['ly'],"id=$id");
 			showmessage(L('add_success'), "?m=caswee&c=contact&action=class");
 		
 
 			
 
	}
	public function delete1(){
		$id=$_GET['id'];
		  	$_username=$this->_username;
	if(!$_username){
			showmessage(L('请登录后再进行操作！'),'index.php?m=member&c=index&a=login');
		}
			$this->casweecontact_db->delete(array('id'=>$id));
			showmessage(L('删除成功！'),'index.php?m=caswee&c=contact&action=class');


	}
}
?>